<template>
	<view class="rank_main" :style="{'--color':vuex_config.themeColor1}">
		<count-down />
		<view class="list">
			<view class="item" v-for="(item,index) in dataList" :key="index" @click="openDetail(item)">
				<view class="left">
					<text class="num">NO.{{index + 1}}</text>
					<image class="item-img" :src="item.img?item.img.split(',')[0]:''" mode="aspectFill">
					</image>
					<view class="name">
						<text>{{item.name}}</text>
						<text class="fnum">{{item.code}}号</text>
					</view>
				</view>
				<view class="right">票数<text class="fonwei">{{item.num || 0}}</text>票</view>
			</view>
		</view>
		<sww-load-more :params="{ ...dataListParams, emptyText: '主办方暂未添加投票项目' }">
		</sww-load-more>
	</view>
</template>

<script>
	import countDown from '../components/countDown.vue'
	import {
		pagingMixin
	} from '@/mixins/pagingMixin.js';
	export default {
		mixins: [pagingMixin],
		props: {
			activityId: {
				type: Number,
				default: 0
			},
			timeForm: {
				type: Object,
				default: () => {
					return {}
				}
			}
		},
		components: {
			'count-down': countDown
		},
		data() {
			return {};
		},
		mounted() {},

		methods: {
			init() {
				if (!this.dataListParams.init) {
					this.initList();
				}
			},
			openDetail (item) {
				this.$linkTo(`/package/activity/vote/detail/index?id=${item.pk_id}&activityId=${this.activityId}`)
			},
			initList() {
				this._init_data('GetVoteInfoPlayer', {
					pk_id: this.activityId
				});
			},
			$onPullDownRefresh() {
				this.initList();
			},
			$onReachBottom() {
				this._load_data();
			},

		}
	};
</script>
<style>
	page {
		background-color: #fff;
	}
</style>
<style scoped lang="scss">
	.rank_main{
		background-color: #fff;
	}
	.list {
		padding: 10rpx 24rpx;

		.item {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 16rpx 0;

			.left {
				display: flex;
				align-items: center;
				flex: 1;
				overflow: hidden;

				.num {
					font-size: 36rpx;
					color: #E98D3A;
				}

				.item-img {
					width: 140rpx;
					height: 140rpx;
					border-radius: 50%;
					margin: 0 20rpx;
				}

				.name {
					display: flex;
					flex-direction: column;
					flex: 1;
					overflow: hidden;

					.fnum {
						color: #999;
					}
				}
			}

			.right {
				color: #F2AC3A;
				.fonwei{
					font-weight: bold;
				}
			}
		}
	}
</style>
